/*
 * Copyright (c) 2006, 2023, webrx.cn All rights reserved.
 *
 */

package org.abc;

import java.util.Calendar;
import java.util.Date;

/**
 * <p>Project: jse2303 - Calendar1
 * <p>Powered by webrx On 2023-07-10 09:32:56
 * <p>描述：<p>
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Calendar1 {
    public static void main(String[] args) {
        //此行代表实例化
        Calendar c = Calendar.getInstance();
        //set student
        System.out.printf("%tF %<tT %<tp %<tA %<tB %<tz%n", c);
        //c.set(Calendar.DATE, 18);
        //c.set(1985, 10 - 1, 20);
        //System.out.printf("%tF %<tT %<tp %<tA %<tB %<tz%n", c);

        //add
        //c.add(5, -5);
        //c.add(Calendar.YEAR, -5);
        c.add(Calendar.WEEK_OF_MONTH, 3);
        //c.add(Calendar.DATE, 5);
        System.out.printf("%tF %<tT %<tp %<tA %<tB %<tz%n", c);

        //get Calendar转换为java.util.Date
        Date dd = c.getTime();//将当前的日历对象转换为日期对象
        long nu = c.getTimeInMillis();
        int year = c.get(Calendar.YEAR);
        System.out.println(year);
        int wk = c.get(Calendar.WEEK_OF_YEAR);
        System.out.println(wk);

        //Date 0 星期日 1星期一

        //1 星期日 2 星期一 3 星期二
        int k = c.get(Calendar.DAY_OF_WEEK);
        System.out.println(k);


    }
}
